﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlServerCe;

namespace MedicineTrackerWPF
{
    public partial class Database
    {
        public class Administrations:Database
        {
            public DataView GetAllAdministrations()
            {
                DataSet dsAdministrations = new DataSet("administrations");
                SqlCeCommand sqlComm;
                using(base.SqlConnection)
                {
                    base.SqlConnection.Open();
                    sqlComm = new SqlCeCommand("SELECT administration_date AS Date, medicine_administered AS Medicine, administered_by AS Administered_By, animal_no AS Animal, quantity_administered AS Qty, site AS Site, seven_day_review AS Seven_Day_Review, review_notes AS Review_Notes, treatment_finished AS Treatment_Finished, reason_for_administration AS Reason, batch_no AS Batch, milk_ok AS Milk_Ok, meat_ok AS meat_ok FROM administrations", base.SqlConnection);

                    SqlCeDataAdapter da = new SqlCeDataAdapter(sqlComm);
                    da.Fill(dsAdministrations);
                }
                return dsAdministrations.Tables[0].DefaultView;
            }
        }
    }
}
